package com.haiyi.activiti.engine.framework.database;

import java.io.Serializable;
import java.util.List;

/**
 * <p> </p>
 *
 * <pre> Created: 2018/12/3 15:01 </pre>
 *
 * @author hlu
 * @version 1.0
 * @since JDK 1.7
 */
public interface Query<T extends Query<?, ?>, U extends Serializable> extends Serializable {

    /**
     * Order the results ascending on the given property as defined in this class (needs to come after a call to one of the orderByXxxx methods).
     */
    T asc(String column);

    /**
     * Order the results descending on the given property as defined in this class (needs to come after a call to one of the orderByXxxx methods).
     */
    T desc(String column);

    /** Executes the query and returns the number of results */
    long count();

    /**
     * Executes the query and returns the resulting entity or null if no entity matches the query criteria.
     *
     */
    U singleResult();

    /** Executes the query and get a list of entities as the result. */
    List<U> list();

    /** Executes the query and get a list of entities as the result. */
    List<U> listPage(long firstResult, long maxResults);

    List<U> listPage2(long currentPage,long size);
}

